package com.example.barcodeapp.ui.wode.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.barcodeapp.R;
import com.example.barcodeapp.ui.own.bean.YouHuiJuanBean;

import java.util.List;

public class YouHuiJuanQuanBuAdapter2 extends RecyclerView.Adapter<YouHuiJuanQuanBuAdapter2.ViewHolder> {
    private Context context;
    private List<YouHuiJuanBean.DataEntity> list;

    public YouHuiJuanQuanBuAdapter2(Context context) {
        this.context = context;
    }

    public YouHuiJuanQuanBuAdapter2(Context context, List<YouHuiJuanBean.DataEntity> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.adapter_youhuijuanquanbu, parent, false);
        return new ViewHolder(inflate);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        holder.youhuijuanname.setText(list.get(position).getYhq_name());
        holder.textView58.setText("有效期至"+list.get(position).getYhq_ff_end());
        holder.textView57.setText(list.get(position).getYhq_mj_jian());
        holder.youhuijuanjiage.setText(list.get(position).getYhq_mj_limit());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {

        private TextView youhuijuantianshu;
        private TextView youhuijuanname;
        private TextView youhuijuanjiage;
        private TextView textView57;
        private TextView youhuijuanneirongxiangqing;
        private TextView textView58;
        private TextView likeshiyongyouhuijuan;
        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            youhuijuantianshu = (TextView) itemView.findViewById(R.id.youhuijuantianshu);
            youhuijuanname = (TextView) itemView.findViewById(R.id.youhuijuanname);
            youhuijuanjiage = (TextView) itemView.findViewById(R.id.youhuijuanjiage);
            textView57 = (TextView) itemView.findViewById(R.id.textView57);
            youhuijuanneirongxiangqing = (TextView) itemView.findViewById(R.id.youhuijuanneirongxiangqing);
            textView58 = (TextView) itemView.findViewById(R.id.textView58);
            likeshiyongyouhuijuan = (TextView) itemView.findViewById(R.id.likeshiyongyouhuijuan);
        }
    }
}
